import Vue from 'vue';
import Router from 'vue-router';
import login from '@/views/login';
import register from '@/views/register';
import index from '@/views/index';

import userList from '@/views/user/userList';
import userCenter from '@/views/user/userCenter';
import changePassword from '@/views/user/changePassword';
import store from '@/views/store/store';
import storeList from '@/views/store/storeList';
import type from '@/views/statistic/type';
import scale from '@/views/statistic/scale';
import address from '@/views/statistic/address';
import notice from '@/views/notice/notice';
import noticeUser from '@/views/notice/noticeUser';

// 启用路由
Vue.use(Router);

// 导出路由
export default new Router({
  routes: [{
    path: '/',
    name: '',
    component: login,
    hidden: true,
    meta: {requireAuth: false}
  }, {
    path: '/login',
    name: '登录',
    component: login,
    hidden: true,
    meta: {requireAuth: false}
  }, {
    path: '/register',
    name: '注册',
    component: register,
    hidden: true,
    meta: {requireAuth: false}
  }, {
    path: '/index',
    name: 'index',
    component: index,
    iconCls: 'el-icon-tickets',
    children: [
      {
        path: '/user/userCenter',
        name: '个人中心',
        component: userCenter,
        hidden: true,
        meta: {requireAuth: false}
      }, {
        path: '/user/changePassword',
        name: '密码修改',
        component: changePassword,
        hidden: true,
        meta: {requireAuth: false}
      },
      {
        path: '/user/userList',
        name: '用户管理',
        component: userList,
        meta: {requireAuth: true}
      },
      {
        path: '/store/store',
        name: '店铺管理',
        component: store,
        meta: {requireAuth: true}
      },
      {
        path: '/store/storeList',
        name: '店铺列表',
        component: storeList,
        meta: {requireAuth: true}
      },
      {
        path: '/statistic/type',
        name: '店铺类型分析',
        component: type,
        meta: {requireAuth: true}
      },
      {
        path: '/statistic/scale',
        name: '店铺规模分析',
        component: scale,
        meta: {requireAuth: true}
      },
      {
        path: '/statistic/address',
        name: '店铺位置分析',
        component: address,
        meta: {requireAuth: true}
      },
      {
        path: '/notice/notice',
        name: '通知列表',
        component: notice,
        meta: {requireAuth: true}
      },
      {
        path: '/notice/noticeUser',
        name: '通知列表',
        component: noticeUser,
        meta: {requireAuth: true}
      }
    ]
  }]
})
